<extend name="Public/base"/>

<block name="body">
	<style>
	.editor{background:none;border:none;}
	</style>
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
	<div class="main-title">
		<h2>{:isset($info['id'])?'编辑':'新增'}项目动态</h2>
	</div>
	<div class="tab-wrap">
		<ul class="tab-nav nav">
			<li data-tab="tab1" class="current"><a href="javascript:void(0);">基 础</a></li>
		</ul>
		<div class="tab-content">
			<form action="{:U()}" method="post" class="form-horizontal"> 
				<!-- 基础 -->
				<div id="tab1" class="tab-pane in tab1">  
					<div class="form-item">
						<label class="item-label">
							标题<span class="check-tips">（请输入标题）</span>
						</label>
						<div class="controls">
							<input type="text" name="title" class="text input-large" value="{$info.title|default=''}" placeholder="请输入标题">
						</div>
					</div>   
					
					<div class="form-item">
						<label class="item-label">
							描述概要<span class="check-tips">（请输入描述概要）</span>
						</label>
						<div class="controls">
							<label class="textarea input-large">
								<textarea name="desc">{$info.desc|default=''}</textarea>
							</label>				
						</div>
					</div>    

					<div class="form-item cf">
                    <label class="item-label">封面<span class="check-tips"></span></label>
                    <div class="controls">  
                        <div class="controls">
                            <input type="file" id="upload_picture_cover_id">
                            <input type="hidden" name="cover_id" id="cover_id_cover_id" value="{$info[cover_id]}"/>
                            <input type='hidden' name="cover" id="cover_src" value="{$info[cover]}"/>
                            <div class="upload-img-box">  
                            <notempty name="info.cover">
                                <div class="upload-pre-item"><img src="{$info.cover}"/></div>
                            </notempty>
                            </div>
                        </div>
                        <script type="text/javascript">
                        //上传图片
                        /* 初始化上传插件 */
                        $("#upload_picture_cover_id").uploadify({
                            "height"          : 30,
                            "swf"             : "__STATIC__/uploadify/uploadify.swf",
                            "fileObjName"     : "download",
                            "buttonText"      : "上传图片",
                            "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                            "width"           : 120,
                            'removeTimeout'   : 1,
                            'fileTypeExts'    : '*.jpg; *.png; *.gif;',
                            "onUploadSuccess" : uploadPicturecover_id,
                            'onFallback' : function() {
                                alert('未检测到兼容版本的Flash.');
                            }
                        });
                        function uploadPicturecover_id(file, data){
                            var data = $.parseJSON(data);
                            var src = '';
                            if(data.status){
                                //$("#cover_id_cover_id").val(data.id); 
                                src = data.url || '__ROOT__' + data.path ; 
                                $("#cover_src").val( src );
                                $("#cover_id_cover_id").parent().find('.upload-img-box').html(
                                    '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                );
                            } else {
                                updateAlert(data.info);
                                setTimeout(function(){
                                    $('#top-alert').find('button').click();
                                    $(that).removeClass('disabled').prop('disabled',false);
                                },1500);
                            }
                        }
                        </script>
                           
                    </div>
                </div>
                
				<div class="form-item cf">
                    <label class="item-label">文章内容<span class="check-tips"></span></label>
                    <div class="controls">
                        <label class="textarea editor">
                            <script id="container" name="content" type="text/plain"> {$info.content|htmlspecialchars_decode} </script> 
                            {:hook('adminArticleEdit', array('name'=>content,'value'=>content))}
		                </label>
		            </div>
                </div>


				<div class="form-item cf">
						<label class="item-label">
							排序<span class="check-tips">（排序从小到大）</span>
						</label>
						<div class="controls">
							<input type="text" name="sort" class="text input-small" value="{$info.sort|default='0'}">  
						</div>
					</div>  

					<div class="form-item">
						<label class="item-label">状态<span class="check-tips">（1-可用，0-禁用）</span></label>
						<div class="controls"> 
							<input type="text" name="status" class="text input-large" value="{$info.status|default='1'}"> 
						</div>
					</div>
				</div> 
				 
				<div class="form-item">
					<input type="hidden" name="id" value="{$info.id|default=''}"> 
					<button type="submit" id="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
					<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
				</div>
		</form>
		</div>
	</div> 
</block>

<block name="script">
	<script type="text/javascript"> 
		//导航高亮
		highlight_subnav('{:U("article")}'); 
	</script>
</block>
